<!--
 * @Description: 
 * @Author: wangqi
 * @Date: 2021-05-23 09:17:19
 * @LastEditTime: 2021-05-23 09:31:24
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>


<script>
    let wqhash = {};
    let val = 12
    Object.defineProperty(wqhash, 'data', {
        // 是否可配置 [属性名是否可被删除]  [以及除 value 和 writable 特性外的其他特性是否可以被修改]
        configurable: true,
        // 可枚举
        enumerable: true,

        // 存取描述符
        get() {
            return val;
        },
        set(newVal) {
            val = newVal;
        },

        // 数据描述符
        // value: 14,
        // 是否可写 [value是否可被修改]
        // writable: true

    });

    wqhash.data = 13;
    console.log(wqhash.data);
    delete wqhash.data;
    console.log(wqhash)
</script>

</html>